﻿using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Distributed;
using SqlSugar;

namespace ztDataNet.Controllers
{
    /// <summary>
    /// 功法登记
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    public class TdController : BaseController<Gf>
    {
        private readonly ISqlSugarClient db;

       /// <summary>
       /// 徒弟修为控制器
       /// </summary>
       /// <param name="db"></param>
       /// <param name="cc"></param>
        public TdController(ISqlSugarClient db, IDistributedCache cc) : base(db, cc)
        {
            this.db = db;
        }
        /// <summary>
        /// id正序
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetAllasc")]
        public async Task<IActionResult> GetAllasc()
        {
            var result = await db.Queryable<Td>().OrderBy(t => t.id, OrderByType.Asc).ToListAsync();

        //    var cacheEntryOptions = new MemoryCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromMinutes(5));
        //    memoryCache.Set($"All{typeof(T).Name}", result, cacheEntryOptions);

            return Ok(result);

        }
    }
}
